
import 'package:flutter/material.dart';
import 'package:flutterlib/common/net/dao_result.dart';
import 'package:flutterlib/common/net/retrofit/activity_api.dart';
import 'package:flutterlib/common/utils/utils.dart';
import 'package:flutterlib/pages/base/base_sliver_list_noappbar.dart';
import 'package:flutterlib/widgets/bussiness/activity/activity_list_item_new.dart';


class ActivitySimpleListWidgetPage extends BaseSliverListNoAppbar {
  final int userId;

  ActivitySimpleListWidgetPage({Key key, this.userId})
      : super(key: key);

  @override
  ActivitySimpleListWidgetPageState createState() => ActivitySimpleListWidgetPageState();
}

///页面 KeepAlive ，同时支持 动画Ticker
class ActivitySimpleListWidgetPageState extends BaseSliverListNoAppbarState<ActivitySimpleListWidgetPage>
    {

  getDataLogic(int page) async {
    print(page);

    var activitys = await ActivityApi.builder().getActivitys(
       widget.userId
    );
    return new DataResult(activitys, true);
  }

  Widget renderItem(index, activity) {
    //提交
    // var activity = pullLoadWidgetControl.dataList[index];
    return ActivityListItemNew(activity, onPressed: () {
      NavigatorUtils.gotoActivityDetail(context, activity.id);
    });
  }

  @override
  List<Widget> renderHeader(BuildContext context, bool innerBoxIsScrolled) {
    return [];
  }
  @override
  bool enablePullDown() {
    return false;
  }

  @override
  bool enablePullUp() {
    return false;
  }

}
